<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
		<link href="../css/sfmain.css" rel="stylesheet" type="text/css"></link>
		<script src="../js/jquery-1.11.3.min.js"></script>
		<script src="../js/common.js"></script>
<!--		<script src="../js/sqlite.js"></script>-->
<!--		<script src="file:///android_asset/page/js/mzf.js"></script>-->
		<script>
		$(function() {
					selectNewData();
		 });
		function saveInfo(){
            var happentime = $("#happentime").val();//随访日期
            var visityType = $("input[name='sffs']:checked").val();//随访方式
            var sfbr = $("input[name='sfbr']:checked").val();//是否本人
            var tgrgx = $("#tgrgx").val();//提供信息者与被访人关系
            var zz = "";//症状
            $('input:checkbox[name=zz]:checked').each(function (i) {
                if (0 == i) {
                    zz = $(this).val();
                } else {
                    zz += ("," + $(this).val());
                }
            });
            var zzqt = $("#zzqt").val();//症状其他
            var tz = "";//体征
             $('input:checkbox[name=tz]:checked').each(function (i) {
                if (0 == i) {
                    tz = $(this).val();
                } else {
                    tz += ("," + $(this).val());
                }
            });
            var tzqt = $("#tzqt").val();//体征其他
            var sfjy = $("input[name='sfjy']:checked").val();//是否戒烟
            var ydcs = $("#ydcs").val();//运动次数
            var ydsc = $("#ydsc").val();//运动时长
            var hxdl = "";//呼吸锻炼
            $('input:checkbox[name=hxdl]:checked').each(function (i) {
                if (0 == i) {
                    hxdl = $(this).val();
                } else {
                    hxdl += ("," + $(this).val());
                }
            });
            var xltz = $("input[name='xltz']:checked").val();//是否心里调整
            var ywmc1 = $("#ywmc1").val();//药物名称1
            var mr1 = $("#mr1").val();//每日1
            var mc1 = $("#mc1").val();//每次1
            var ywmc2 = $("#ywmc2").val();//药物名称2
            var mr2 = $("#mr2").val();//每日2
            var mc2 = $("#mc2").val();//每次2
            var ywmc3 = $("#ywmc3").val();//药物名称3
            var mr3 = $("#mr3").val();//每日3
            var mc3 = $("#mc3").val();//每次3
            var ywmc4 = $("#ywmc4").val();//药物名称1
            var mr4 = $("#mr4").val();//每日4
            var mc4 = $("#mc4").val();//每次4
            var ywblfy = $("input[name='sfywblfy']:checked").val();//药物不良反应
<!--            var ywblfy = $("#ywblfy").val();//药物不良反应内容-->
            var fyycx = $("input[name='fyycx']:checked").val();//服药依从性
            var sffl = $("input[name='sffl']:checked").val();//此次随访分类
            var sfys = $("#sfys").val();//随访医生
            var insertsql = "insert into mzf(id,personid,name,sex,happentime,visityType,sfbr,tgrgx,zz,zzqt,tz,tzqt,sfjy,ydcs,"
                                        +"ydsc,hxdl,xltz,ywmc1,mr1,mc1,ywmc2,mr2,mc2,ywmc3,mr3,mc3,ywmc4,mr4,mc4,ywblfy,fyycx,sffl,sfys) values("
                            +"'"+Math.floor(Math.random()*10)+"',"
                            +"'"+personid+"',"
                            +"'"+name+"',"
                            +"'"+sex+"',"
                            +"'"+happentime+"',"
                            +"'"+visityType+"',"
                            +"'"+sfbr+"',"
                            +"'"+tgrgx+"',"
                            +"'"+zz+"',"
                            +"'"+zzqt+"',"
                            +"'"+tz+"',"
                            +"'"+tzqt+"',"
                            +"'"+sfjy+"',"
                            +"'"+ydcs+"',"
                            +"'"+ydsc+"',"
                            +"'"+hxdl+"',"
                            +"'"+xltz+"',"
                            +"'"+ywmc1+"',"
                            +"'"+mr1+"',"
                            +"'"+mc1+"',"
                            +"'"+ywmc2+"',"
                            +"'"+mr2+"',"
                            +"'"+mc2+"',"
                            +"'"+ywmc3+"',"
                            +"'"+mr3+"',"
                            +"'"+mc3+"',"
                            +"'"+ywmc4+"',"
                            +"'"+mr4+"',"
                            +"'"+mc4+"',"
                            +"'"+ywblfy+"',"
                            +"'"+fyycx+"',"
                            +"'"+sffl+"',"
                            +"'"+sfys+"'"
                            +")";
            var jg = app.InsertSql(insertsql);
            if("success"==jg){
                alert("操作成功！");
            }

}

function selectNewData(){

	var selectsql = 'select * from mzf where personid='+personid+" order by happentime desc";
	var data = app.getInfo6(selectsql);
	var obj = eval('(' + data + ')');
	if(null!=obj&&obj.length>0){
		var info = obj[0];
		$("#xm").html(info.name);
		$("#xb").html(info.sex);
		$("#happentime").val(info.happentime);//随访日期
		$("input[name=sffs]:eq("+info.visityType+")").attr("checked",'checked');//随访方式
		$("input[name=sfbr]:eq("+info.sfbr+")").attr("checked",'checked');//是否本人
		$("#tgrgx").val(info.tgrgx);//提供信息者与被访人关系
		var zz = info.zz;//症状
		if(null!=zz&&zz.length>0){
			$(zz.split(",")).each(function (i,e){
				$("input[name='zz'][value='"+e+"']").prop("checked",true);
			});
<!--			var zzStr = zz.split(",");-->
<!--			for(var i=0;i<zzStr.length;i++){-->
<!--			$("input[name='zz'][value='"+zzStr[i]+"']").prop("checked",true);-->
<!--			}-->
		}

		$("#zzqt").val(info.zzqt);//症状其他
		var tz = info.tz;//体征
		if(null!=tz&&tz.length>0){
			$(tz.split(",")).each(function (i,e){
				$("input[name='tz'][value='"+e+"']").prop("checked",true);
			});
		}
		$("#tzqt").val(info.tzqt);//体征其他
		$("input[name=sfjy]:eq("+info.sfjy+")").attr("checked",'checked');//是否戒烟
		$("#ydcs").val(info.ydcs);//运动次数
		$("#ydsc").val(info.ydsc);//运动时长
		var hxdl = info.hxdl;//呼吸锻炼
		if(null!=hxdl&&hxdl.length>0){
			$(hxdl.split(",")).each(function (i,e){
				$("input[name='hxdl'][value='"+e+"']").prop("checked",true);
			});
		}
		$("input[name=xltz]:eq("+info.xltz+")").attr("checked",'checked');//是否心里调整
		$("#ywmc1").val(info.ywmc1);//药物名称1
		$("#mr1").val(info.mr1);//每日1
		$("#mc1").val(info.mc1);//每次1
		$("#ywmc2").val(info.ywmc2);//药物名称2
		$("#mr2").val(info.mr2);//每日2
		$("#mc2").val(info.mc2);//每次2
		$("#ywmc3").val(info.ywmc3);//药物名称3
		$("#mr3").val(info.mr3);//每日3
		$("#mc3").val(info.mc3);//每次3
		$("#ywmc4").val(info.ywmc4);//药物名称1
		$("#mr4").val(info.mr4);//每日4
		$("#mc4").val(info.mc4);//每次4
		$("input[name='sfywblfy'][value='"+info.ywblfy+"']").prop("checked",true);//药物不良反应
		$("input[name='fyycx'][value='"+info.fyycx+"']").prop("checked",true);//服药依从性
		$("input[name='sffl'][value='"+info.sffl+"']").prop("checked",true);//此次随访分类
		 $("#sfys option[value='"+info.sfys+"']").attr("selected","selected");//随访医生
	}

}
  function sfbrcha(val){
            if("1"==val){
                $("#tgrgx").attr("disabled",false);
            }else{
                $("#tgrgx").attr("disabled",true);
            }
        }

        function zzqtxz(val){
        	if("4"==val){
        		$("#zzqt").attr("disabled",false);
        	}else{
        		$("#zzqt").attr("disabled",true);
        	}
        }
		</script>
	</head>
	<body>
		<div class="dh">
			<div class="dhleft">
				<span>慢阻肺随访记录表</span>
			</div>
			<div class="bc" onclick="saveInfo()">
				<img  class="bcimg" src="../img/icon-save.png"/>
				<span class="bcspan">保存</span>
			</div>
		</div>
		<div class="maindiv">
			<div class="sfxx">
				<span class="sfxxspan">随访信息</span>
			</div>
			<div>
				<hr class="titleline" />
			</div>
			<div class="titlaspan">
				<span>基本信息</span>
      </div>
      <div class="titlebody">
        <div>
			<span class="span1">姓名：</span>
			<span  id="xm" style="margin-left:5px;"></span>
			<span class="span1" style="margin-left: 100px;" >性别：</span>
			<span  id="xb" style="margin-left:5px;"></span>
        </div>
        <div>
          <span class="span1">随访日期：</span>
          <input class="timeinput" id="happentime" type="date"/>
          
        </div>
		<div>
		  <span class="span1" >随访方式：</span>
		  <input class="radio_type" type="radio" value="1" name="sffs" id="sffs1" checked="checked"/>
		  <label for="sffs1">门诊</label>
		  <input class="radio_type" type="radio" value="2" name="sffs" id="sffs2" /> 
		  <label for="sffs2">家庭</label>
		  <input class="radio_type" type="radio" value="3" name="sffs" id="sffs3" />
		  <label for="sffs2">通过电话或者手机短信（微信）联系患者本人或者家人</label><br>
			<input class="radio_type" type="radio" style="margin-left: 105px;" value="4" name="sffs" id="sffs4" />
		  <label for="sffs4">其他地方进行面对面教育</label>
		  <input class="radio_type" type="radio" value="5" name="sffs" id="sffs5" />
		  <label for="sffs5">其他</label>
		</div>
        <div>				
          <span class="span1">是否本人：</span>
          <input class="radio_type" type="radio" onchange="sfbrcha(this.value)" name="sfbr" value="0" id="sfbr1" checked="checked"/>
          <label for="sfbr1">是</label>
          <input class="radio_type" type="radio" onchange="sfbrcha(this.value)" name="sfbr" value="1" id="sfbr2" />
          <label for="sfbr2">否</label>
          <span class="span1" style="width:auto;">提供信息者与被调查人直接的关系：</span>
          <input type="text" class="inputcss" id="tgrgx"/>
        </div>
       
      </div>
	  
		<div class="titlaspan">
		<span>症状</span>
      </div>

      <div class="titlebody">
        <div>
		  <input type="checkbox" class="inputbox" value="1" name="zz" id="zz1"/>
		  1咳嗽
         <input type="checkbox" class="inputbox" value="2" style="margin-left: 20px;padding-left:20px;" name="zz" id="zz2"/>
         2咳痰
		 <input type="checkbox" class="inputbox" value="3"  style="margin-left: 20px;padding-left:20px;" name="zz" id="zz3"/>
		 3呼吸困难
			<br>
		 <input type="checkbox" class="inputbox"  onclick="zzqtxz(this.value)"  value="4" name="zz" id="zz4"/>
		 4其他
		 <input type="text" class="inputcss" id="zzqt"  style="width: 200px;"/>
        </div>
       
      </div>
	  <div class="titlaspan">
	  		<span>体征</span>
	  </div>
	  <div class="titlebody">
		<div >
	    <input type="checkbox" class="inputbox" value="1" name="tz" id="tz1"/>
	    1口唇紫绀
	    <input type="checkbox" class="inputbox" value="2" style="margin-left: 20px;padding-left:20px;" name="tz" id="tz2"/>
	    2哮鸣音/湿罗音
	    <input type="checkbox" class="inputbox" value="3" style="margin-left: 20px;padding-left:20px;" name="tz" id="tz3"/>
	    3下肢水肿<br>
	    <input type="checkbox" class="inputbox" value="4" name="tz" id="tz4"/>
	    4其他
	    <input type="text" class="inputcss" id="tzqt"  style="width: 200px;"/>
		</div>
	  </div>
	  <div class="titlaspan">
	  	<span>生活方式指导</span>
	  </div>
	  <div class="titlebody">
		<div>
			<span class="span1" style="width:auto">戒烟：</span>
			<input class="radio_type" type="radio" value="0" name="sfjy" id="sfjy1"/>
			<label for="sfjy1">是</label>
			<input class="radio_type" type="radio" value="1" name="sffy" id="sfjy2" /> 
			<label for="sfjy2">否</label>
			<span class="span2">运动：</span>
			<input type="number" class="inputcss" style="width:30px" id="ydcs"/><span class="dw">次/周</span>
			<input type="number" class="inputcss"  style="width:30px" id="ydsc"/><span class="dw">分钟/次</span>
		  </div>
	  <div >
	    <span class="span1" style="width:auto">呼吸锻炼：</span>
	   <input type="checkbox" class="inputbox" value="1" name="hxdl"/>
	   腹式呼吸
	   <input type="checkbox" class="inputbox" value="2" name="hxdl"/>
	   缩唇呼吸
	  </div>
	  <div>	    
	    <span class="span1">心理调整：</span>
	    <input class="radio_type" type="radio" value="1" name="xltz" id="xltz1"  checked="checked"/>
	    <label for="xltz1">良好</label>
	    <input class="radio_type" type="radio" value="2" name="xltz" id="xltz2"/> 
	    <label for="xltz2">一般</label>
	    <input class="radio_type" type="radio" value="3" name="xltz" id="xltz3"/>
	    <label for="xltz3">差</label>
	  </div>
	  </div>
	  <div class="titlaspan">
	  	<span>用药情况</span>
	  </div>
	  <div class="titlebody">
		  <div >
	    <span class="span1">药物名称1：</span>
		<input type="text" class="inputcss" id="ywmc1" style="width: 120px;"/>
	    <span class="span2">用法：每日：</span>
	    <input type="number" class="inputcss" id="mr1" style="width: 30px;"/><span class="dw">次</span>
		<span class="span2">每次：</span>
		<input type="number" class="inputcss" id="mc1" style="width:30px;"/>
	  </div>
	  <div>
	    <span class="span1">药物名称2：</span>
	  		<input type="text" class="inputcss" id="ywmc2" style="width: 120px;"/>
	    <span class="span2">用法：每日：</span>
	    <input type="number" class="inputcss" id="mr2" style="width: 30px;"/><span class="dw">次</span>
	  		<span class="span2">每次：</span>
	  		<input type="number" class="inputcss" id="mc2" style="width: 30px;"/>
	  </div>
	  <div>
	    <span class="span1">药物名称3：</span>
	  		<input type="text" class="inputcss" id="ywmc3" style="width: 120px;"/>
	    <span class="span2">用法：每日：</span>
	    <input type="number" class="inputcss" id="mr3" style="width:30px;"/><span class="dw">次</span>
	  		<span class="span2">每次：</span>
	  		<input type="number" class="inputcss" id="mc3" style="width: 30px;"/>
	  </div>
	  <div>
	    <span class="span1">其他药物：</span>
	  		<input type="text" class="inputcss" id="ywmc4" style="width: 120px;"/>
	    <span class="span2">用法：每日：</span>
	    <input type="number" class="inputcss" id="mr4" style="width: 30px;"/><span class="dw">次</span>
	  		<span class="span2">每次：</span>
	  		<input type="number" class="inputcss" id="mc4" style="width: 30px;"/>
	  </div>
	  <div>
	    <span class="span1" style="width:auto">药物不良反应：</span>
	    <input class="radio_type" type="radio" value="0" name="sfywblfy" id="ywblfy1"/>
	    <label for="ywblfy1">有</label>
	    <input class="radio_type" type="radio" value="1" name="sfywblfy" id="ywblfy2" /> 
	    <label for="ywblfy2">无</label>
	    <span class="span2">服药依从性：</span>
	    <input class="radio_type" type="radio" value="1" name="fyycx" id="fyycx1"/>
	    <label for="fyycx1">规律</label>
	    <input class="radio_type" type="radio" value="2" name="fyycx" id="fyycx2" /> 
	    <label for="fyycx2">间断</label>
		<input class="radio_type" type="radio" value="3" name="fyycx" id="fyycx3" />
		<label for="fyycx3">不服药</label>
	  </div>
	  
	  </div>
	  <div class="titlaspan">
	  	<span>此次随访分类</span>
	  </div>
	  <div class="titlebody">
		  <div>
			  <input class="radio_type" type="radio" value="0" name="sffl" id="sffl1"/>
			  <label for="sffl1">1控制满意</label>
			  <input class="radio_type" type="radio" value="2" name="sffl" id="sffl2"/>
			  <label for="sffl2">2控制不满意</label>
			  <input class="radio_type" type="radio" value="3" name="sffl" id="sffl3"/>
			  <label for="sffl3">3不良反应</label>
			  <input class="radio_type" type="radio" value="4" name="sffl" id="sffl4"/>
			  <label for="sffl4">4并发症</label>
		  </div>
	  </div>
	  <div  class="titlebody">
	    <span class="span1">随访医生：</span>
		  <select class="inputcss"   id="sfys">

		  </select>
	  </div>
	 
	</div>
	</body>
</html>
